home *** CD-ROM | disk | FTP | other *** search
- /* hAWK_time.c : the time() function */
- /* Copyright © 1986, 1988, 1989 1991 the Free Software Foundation, Inc.
- * This file is part of GAWK, the GNU implementation of the
- * AWK Progamming Language, modified for the Macintosh (also called hAWK).
- * GAWK is free software; you can redistribute or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 1, or any later version.
- * GAWK is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with GAWK; see the file "COPYING hAWK". If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * Written for THINK C 4 on the Macintosh by Ken Earle (Dynabyte) Aug 1991.
- */
- #include "AWK.H"
-
- NODE *do_time(NODE *tree);
-
- NODE *do_time(NODE *tree)
- {
- time_t now;
- struct tm *date;
- char s[80];
- short i;
-
- now = time(NULL);
- date = localtime(&now);
- i = strftime(s,80, "%A, %B %d, %Y %I:%M:%S %p", date);
- return(tmp_string(s, i));
- }
-